/*
 * Powered By [fdlm]
 * Web Site: http://www.fdlm.cn
 * Since 2014 - 2015
 */

package com.sjyy.account.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import cn.org.rapid_framework.util.DateConvertUtils;

import java.util.*;

import com.sjyy.account.model.*;
import com.sjyy.account.service.*;
import com.sjyy.account.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @author cty email:caotianye@fdlm.cn
 * @version 1.0
 * @since 1.0
 */


public class Account extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Account";
	public static final String ALIAS_ACCOUNT_ID = "accountId";
	public static final String ALIAS_ACCOUNT = "account";
	public static final String ALIAS_PASSWORD = "password";
	public static final String ALIAS_ROLE = "0:医生 1:患者 2:员工";
	public static final String ALIAS_STATUS = "0:禁止 1:启用";
	public static final String ALIAS_AREA_ID = "areaId";
	public static final String ALIAS_REGISTER_TIME = "注册时间";
	public static final String ALIAS_LAST_LOGIN_TIME = "最后登录时间";
	
	//date formats
	public static final String FORMAT_REGISTER_TIME = DATE_FORMAT;
	public static final String FORMAT_LAST_LOGIN_TIME = DATE_FORMAT;
	
	//columns START
    /** accountId       db_column: account_id */	
	
	private java.lang.Integer accountId;
    /** account       db_column: account */	
	@NotBlank @Length(max=32)
	private java.lang.String account;
    /** password       db_column: password */	
	@NotBlank @Length(max=32)
	private java.lang.String password;
    /** 0:医生 1:患者 2:员工       db_column: role */	
	@NotNull 
	private java.lang.Integer role;
    /** 0:禁止 1:启用       db_column: status */	
	@NotNull 
	private java.lang.Integer status;
    /** areaId       db_column: area_id */	
	
	private java.lang.Integer areaId;
    /** 注册时间       db_column: register_time */	
	@NotNull 
	private java.util.Date registerTime;
    /** 最后登录时间       db_column: last_login_time */	
	
	private java.util.Date lastLoginTime;
	//columns END

	public Account(){
	}

	public Account(
		java.lang.Integer accountId
	){
		this.accountId = accountId;
	}

	public void setAccountId(java.lang.Integer value) {
		this.accountId = value;
	}
	
	public java.lang.Integer getAccountId() {
		return this.accountId;
	}
	public void setAccount(java.lang.String value) {
		this.account = value;
	}
	
	public java.lang.String getAccount() {
		return this.account;
	}
	public void setPassword(java.lang.String value) {
		this.password = value;
	}
	
	public java.lang.String getPassword() {
		return this.password;
	}
	public void setRole(java.lang.Integer value) {
		this.role = value;
	}
	
	public java.lang.Integer getRole() {
		return this.role;
	}
	public void setStatus(java.lang.Integer value) {
		this.status = value;
	}
	
	public java.lang.Integer getStatus() {
		return this.status;
	}
	public void setAreaId(java.lang.Integer value) {
		this.areaId = value;
	}
	
	public java.lang.Integer getAreaId() {
		return this.areaId;
	}
	public String getRegisterTimeString() {
		return DateConvertUtils.format(getRegisterTime(), FORMAT_REGISTER_TIME);
	}
	public void setRegisterTimeString(String value) {
		setRegisterTime(DateConvertUtils.parse(value, FORMAT_REGISTER_TIME,java.util.Date.class));
	}
	
	public void setRegisterTime(java.util.Date value) {
		this.registerTime = value;
	}
	
	public java.util.Date getRegisterTime() {
		return this.registerTime;
	}
	public String getLastLoginTimeString() {
		return DateConvertUtils.format(getLastLoginTime(), FORMAT_LAST_LOGIN_TIME);
	}
	public void setLastLoginTimeString(String value) {
		setLastLoginTime(DateConvertUtils.parse(value, FORMAT_LAST_LOGIN_TIME,java.util.Date.class));
	}
	
	public void setLastLoginTime(java.util.Date value) {
		this.lastLoginTime = value;
	}
	
	public java.util.Date getLastLoginTime() {
		return this.lastLoginTime;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("AccountId",getAccountId())
			.append("Account",getAccount())
			.append("Password",getPassword())
			.append("Role",getRole())
			.append("Status",getStatus())
			.append("AreaId",getAreaId())
			.append("RegisterTime",getRegisterTime())
			.append("LastLoginTime",getLastLoginTime())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getAccountId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Account == false) return false;
		if(this == obj) return true;
		Account other = (Account)obj;
		return new EqualsBuilder()
			.append(getAccountId(),other.getAccountId())
			.isEquals();
	}
}

